package cn.swust.designpatternlearningplatform.service.impl;

import cn.swust.designpatternlearningplatform.dao.TopicKnowledgePointDao;
import cn.swust.designpatternlearningplatform.domain.entity.KnowledgePoint;
import cn.swust.designpatternlearningplatform.service.TopicKnowledgePointService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class TopicKnowledgePointImpl implements TopicKnowledgePointService {
    @Resource
    private TopicKnowledgePointDao topicKnowledgePointDao;


    /**
     * 获取子id
     *
     * @param pointId
     * @return java.util.List<cn.swust.designpatternlearningplatform.domain.entity.KnowledgePoint>
     * @author Tang
     * @date 2023/4/16 2:34
     **/
    @Override
    public List<KnowledgePoint> getKnowledgePointSonId(Integer pointId) {
        return topicKnowledgePointDao.selectKnowledgePointSonId(pointId);
    }

    /**
     * 根据id获取知识点信息
     *
     * @param id
     * @return cn.swust.designpatternlearningplatform.domain.entity.KnowledgePoint
     * @author Tang
     * @date 2023/4/16 2:35
     **/
    @Override
    public KnowledgePoint getKnowledgePointById(Integer id) {
        return topicKnowledgePointDao.selectKnowledgePointById(id);
    }

    /**
     * 根据知识点名字获取id
     *
     * @param name
     * @return java.lang.Integer
     * @author Tang
     * @date 2023/7/8 13:23
     **/
    @Override
    public Integer getKnowledgeIdByName(String name) {
        return topicKnowledgePointDao.selectPointIdByContent(name);
    }
}
